<!DOCTYPE html>
<html>
<head>

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

</head>

<body>

系统载入中，请稍等...

<?php
//验证登陆信息
session_start();

include_once("../config.php");
include_once '../connection.php';

$account = $_POST['account'];
$name = $_POST['name'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$code = $_POST['code'];


$unit['ai_mid']=$_POST['account'];
$unit['ai_mima']=md5($_POST['password']);

$regcode = strrev(substr($phone+1234,7));
if($code!=$regcode){
    echo "<script language='javascript'>alert('验证码错误！');location='register.php';</script>";
    exit;
}

if (!preg_match("/^[0-9a-zA-Z]{6,12}$/", $account)) {echo "<script language='javascript'>alert('非法用户名！');location='register.php';</script>"; exit;}
if (strlen($password) < 6 && strlen($password) > 12 ) {echo "<script language='javascript'>alert('请输入正确的密码长度！');location='register.php';</script>";}
if($password != $repassword){echo "<script language='javascript'>alert('密码不匹配！');location='register.php';</script>";}




$_check_member=select_one_line_all_items($table_prefix."unit","account='mid'");



if ($_check_member['nid']) {
    echo "<script language='javascript'>alert('该账号已存在！');location='register.php';</script>";
} else{

    $_new_unit=insert_data($table_prefix."unit",$unit);

    $query = mysql_query($_new_unit) or die ("error:".mysql_error());
    mysql_close($con);

    echo '<script type="text/javascript">alert("注册成功，待通过审核，点击确认返回继续操作.");document.location.href = "index.php";</script>';
}


?>
</body>